$(function(){
	
	var options = { 
        beforeSubmit:  showRequest,  // pre-submit callback 
        success:       showResponse,  // post-submit callback 
 
        dataType:  'json',        // 'xml', 'script', or 'json' (expected server response type) 
        clearForm: true        // clear all form fields after successful submit 

    }; 
 

    $('#form_user').submit(function() { 

        $(this).ajaxSubmit(options); 

        return false; 
    }); 
});


function showRequest(formData, jqForm, options) { 
    //var queryString = $.param(formData); 
    return true; 
} 

function showResponse(data, statusText, xhr, $form)  { 
	if(data.success){
		alert(data.message);
		location.href= '/index.php/Admin/Users/';
	}else{
		alert(data.message);
	}
}